Facial recognition is a popular computer technology in recent years and is one of biometric recognition technologies. The biometric recognition technologies further include fingerprint recognition, iris recognition, and the like. These recognition technologies can achieve a high recognition rate. However, when these biometric recognition technologies are applied, a to-be-recognized person needs to cooperate well. That is, these recognition technologies have a strict requirement for a person and an environment, so that application of these technologies, for example, in a public place, a densely populated place, and a non-compulsory civil field, is greatly limited. Facial recognition can break through the foregoing limitation, and is more widely applied.
After decades of development, many methods are generated for the facial recognition technology, for example, template matching, learning from examples, and a neural network. A facial recognition method based on a joint Bayesian probability model is a common facial recognition method. Using the joint Bayesian probability model to verify whether two face images are face images of a same person has high accuracy. The following briefly describes the facial recognition method based on the joint Bayesian probability model.
First, a joint Bayesian probability matrix P is generated by means of training. Then a feature v1 of a to-be-verified face f1 and a feature v2 of a to-be-verified face f2 are extracted separately. Next, the v1 and the v2 are spliced into a vector [v1,v2], and finally a distance between the v1 and the v2 is calculated by using the following formula (1):s=[v1,v2]*P*[v1,v2]T  (1)
When the distance is less than a preset threshold, the f1 and the f2 are of the same person; when the distance is greater than the preset threshold, the f1 and the f2 are of different persons. The joint Bayesian probability matrix P may be obtained by means of offline learning. When the joint Bayesian probability matrix P is learned, the entire matrix P may be directly learned, or the P matrix may be decomposed by using the following formula (2):
                    s        =                              [                                          v                ⁢                                                                  ⁢                1                            ,                              v                ⁢                                                                  ⁢                2                                      ]                    ⋆                      [                                                            A                                                  B                                                                              B                                                  A                                                      ]                    ⋆                                    [                                                v                  ⁢                                                                          ⁢                  1                                ,                                  v                  ⁢                                                                          ⁢                  2                                            ]                        T                                              (        2        )            
A submatrix A and a submatrix B are quickly learned separately. A is a cross-correlation submatrix in the joint Bayesian probability matrix P, and B is an autocorrelation submatrix in the joint Bayesian probability matrix P. When this method is used for facial recognition, a face image database needs to be pre-established. Each vector in the face image database corresponds to one identity. In a recognition process, the feature vector v1 of the face f1 needs to be compared with each vector in the face image database by using the formula (1) or the formula (2), to obtain a distance s between the feature vector v1 and the vector in the face image database; and a vector having a smallest distance from the v1 is selected from the face image database as a matching vector of the v1. When a distance between the matching vector and the v1 is less than the preset threshold, an identity corresponding to the matching vector in the face image database is determined as an identity of the f1. When the distance between the matching vector and the v1 is greater than the preset threshold, it indicates that the identity of the face f1 is not recorded in the face image database, and a new identity may be allocated to the f1 and a correspondence between the new identity and the v1 is established in the database.
It can be seen from the foregoing description that when a facial recognition method based on a joint Bayesian probability model is used, a to-be-matched face feature vector needs to be compared with all vectors in a face image database. Generally, the face image database is of a large scale, and comparison with each vector in the database by using a formula s−[v1,v2]*P*[v1,v2] results in a large calculation burden and consumes a long time, which is not helpful for fast facial recognition.